Most of the function is already asynchronous, except for the
initialization of the returned proxy. gjs' D-Bus wrapper gained
some convenience API a while ago that makes this trivial enough,
so use it.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3636>
try {
const [objectPath] = await this._proxy.GetSessionAsync(sessionId);
- this._currentSession = new SystemdLoginSession(Gio.DBus.system,
- 'org.freedesktop.login1', objectPath);
+ this._currentSession = await SystemdLoginSession.newAsync(
+ Gio.DBus.system, 'org.freedesktop.login1', objectPath);
return this._currentSession;
} catch (error) {
logError(error, 'Could not get a proxy for the current session');